<!DOCTYPE html>
<HTML>
<HEAD><meta name="viewport" content="width=device-width, initial-scale=1">
<Title>PieChart.setLabelLayout</Title>
<link type='text/css' rel='Stylesheet' href="maxchartapi.css" />
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">

<p class="heading0">ChartDirector 7.0 (Java Edition)</p>
<p class="heading1"><a href="PieChart.htm">PieChart</a>.<wbr>setLabelLayout</p>
<hr class="separator">
<p class="heading2a">Usage</p>
<div class="content">
public void setLabelLayout(int layoutMethod [, int pos [, int topBound [, int bottomBound ]]])
</div>
<p class="heading2">Description</p>
<div class="content">
Sets the layout method and location of the sector labels.<br><br>
This method affects all sectors. To set the sector label layout method and location for one particular sector only, use <a href="Sector.setLabelLayout.htm">Sector.setLabelLayout</a>.<br><br>
ChartDirector supports two sector label layout methods - circular layout and side layout. The layout method is determined using the <b>layoutMethod</b> argument, which must be one of the following predefined constants.<br><br>
<div style="width:100%;box-sizing:border-box;"><table width="100%" border="1" cellpadding="5" cellspacing="0"> <tr><th width="19%">Constant<th width="19%%">Value<th>Description <tr><td><a href="Chart.SideLayout.htm">SideLayout</a><td>0<td>Side Label Layout <tr><td><a href="Chart.CircleLayout.htm">CircleLayout</a><td>1<td>Circular Label Layout </table></div><br>
In the circular layout method, the sector labels are positioned around the perimeter of the pie.<br><br>
In the side layout method, there is an invisible rectangle containing the pie, where the rectangle can be wider than the diameter of the pie.The sector labels are positioned on the left and right sides outside the rectangle. Because the labels can be quite far away from the sectors, join lines are typically used to connect the labels to the sectors.<br><br>
The circular layout method usually uses less space and is the default layout method. However, if the pie chart contains a lot of small sectors, the labels may overlap with each others, due to insufficient space on the pie perimeter to position the labels.<br><br>
The side layout method has the advantages that it can avoid label overlapping. In the side layout method, labels will automatically shift up and down to avoid overlapping.<br><br>
One common issue in pie charts is the data contain a lot of small sectors. If the data are sorted, the small sectors will be crowded together instead of distributed evenly. Although the side layout method can avoid label overlapping by shifting the labels up and down, some labels may need to be shifted great distances.<br><br>
Label layout can often be improved if the small sectors are near the horizontal axis. It is because the amount of vertical label space for a sector is greatest at the horizontal axis. This can be achieved by choosing an appropriate start angle (using <a href="PieChart.setStartAngle.htm">PieChart.setStartAngle</a>).<br><br>
If the data is in ascending order (small sectors crowded at the beginning), a start angle of 45 degrees with clockwise sector layout is recommended. With this setting, the first few sectors (the smallest sectors) will be at around 45 - 135 degrees, so is near the horizontal axis (90 degrees). Similarly, if the data is in descending order (small sectors crowded at the end), a start angle of 135 degrees with clockwise sector layout can be used.
</div>
<p class="heading2">Arguments</p>
<div class="content">
<div style="width:100%;box-sizing:border-box;">
<table border="1" cellpadding="5" cellspacing="0" width="100%"> 
<tr>
<th width="19%">Argument</th><th width="19%">Default</th><th>Description</th>
</tr>
<tr>
<td>layoutMethod</td><td>(Mandatory)</td><td>Specify the layout method. Must be one of the predefined constants <a href="Chart.CircleLayout.htm">CircleLayout</a> or <a href="Chart.SideLayout.htm">SideLayout</a>.</td></tr><tr><td>pos</td><td>-1</td><td>For circular layout, it is the distance between the sector perimeter and the sector label. A negative value (but not -1) means the sector label will be drawn in the interior of the sector.<br><br>
For side layout, it is the distance between the pie perimeter and the left or right edges of the invisible containing rectangle (equal to the width of the rectangle minus the pie diameter and then divided by 2).<br><br>
In either case, -1 means the distance is automatically determined.</td></tr><tr><td>topBound</td><td>-1</td><td>This parameter applies only to side label layout. It controls the top bound of the labels (the minimum y coordinate), thereby limiting the extent that the labels can be shifted up to avoid overlapping. This parameter is typically used avoid the labels from moving up too much and overlap with other chart objects (such as the chart title).</td></tr><tr><td>bottomBound</td><td>-1</td><td>This parameter applies only to side label layout. It controls the bottom bound of the labels (the maximum y coordinate), thereby limiting the extent which the labels can be shifted down to avoid overlapping. This parameter is typically used to avoid the labels from moving down too much and overlap with other chart objects.</td>
</tr>
</table>
</div>
</div>
<p class="heading2">Return Value</p>
<div class="content">
None
</div>
<br><hr class="separator">
<div class="copyright">&copy; 2022 Advanced Software Engineering Limited. All rights reserved.</div>
</body>
</HTML>
